package com.sinosun.autotestmachine.tools.reader;

/**
 * 设备状态枚举
 * @author HYW
 *
 */
public enum Status {
	BUSY(0, "busy"),			//忙碌
	IDLE(1, "idle")				//空闲
	;
	private int value;
	private String valueStr;
	
	Status(int value, String valueStr) {
		this.value = value;
		this.valueStr = valueStr;
	}
	
	public static Status valueOf(int value) {
		switch(value)
		{
		case 0:
			return BUSY;
		case 1:
			return IDLE;
		default:
			return null;
		}
	}
	
	public static Status valueStrOf(String valueStr) {
		if (valueStr.equals("idle")) {
			return IDLE;
		} else if (valueStr.equals("busy")) {
			return BUSY;
		} else {
			return null;
		}
	}
	
	public int value() {
		return this.value;
	}
	
	public String valueStr() {
		return this.valueStr;
	}
}
